<? 
		if(isset($_POST['btnsubmit']))
		{
			require("required/dbconnect.php"); 
			
			$branch_name=mysql_escape_string($_POST['branch_name']);
			$address=mysql_escape_string($_POST['address']);
			$address=str_replace("\n","<br>",$address);
			$tel=$_POST['tel'];
			$fax=$_POST['fax'];
			
			
			$insert=mysql_query("insert into os_branch(branch_name,address,tel,fax,create_datetime)value('$branch_name','$address','$tel','$fax',now())")or die(mysql_error());
			header("Location:branch.php");
?>
			
<?			
		
		}
		else
		{
				require("required/dbconnect.php"); 
				require("required/function.php"); 
				require("required/header.php"); 
				
				checkAccess("allow_user_management",1);
?>
				
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
				</script>
				<script type="text/javascript" src="required/js/calendarDateInput.js"></script>		
					
					<td width="84%" align="left" valign="top">
					
						<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm" method="post" onSubmit="return validatefrm(this)">
						<table width="100%">
						
						<td class="title" colspan="3">
						<strong>Add Branch</strong>
						</td>
						
						
						<tr>
							<td>Branch name</td><td>:</td><td><input class="text" type="text" name="branch_name" size="30" value="" maxlength="200"></td>
						</tr>
						<tr valign="top">
							<td>Address</td><td>:</td><td><textarea rows="5" cols="30" class="text" name="address"></textarea></td>
						</tr>
						<tr>
							<td>Tel</td><td>:</td><td><input class="text" type="text" name="tel" size="30" value="" maxlength="200"></td>
						</tr>
						<tr>
							<td>Fax</td><td>:</td><td><input class="text" type="text" name="fax" size="30" value="" maxlength="200"></td>
						</tr>
						<tr>
							<td colspan="2"><input type="submit" value="Submit" name="btnsubmit"></td>
						</tr>
						</table>
						</form>
					</td>
				 
				</table>
<? }require("required/footer.php"); ?>